﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

public partial class ZXJX_ZXGZKP : System.Web.UI.Page
{
    public DataTable dt1;
    public string get_str;

    protected void Page_Load(object sender, EventArgs e)
    {
        //给统计年和统计月赋值
        int year = DateTime.Now.Year;
        int month = DateTime.Now.Month;

        for (int i = year - 10; i <= year; i++)
        {
            tjn.Items.Add(new ListItem(i.ToString(), i.ToString()));
        }

        for (int i = 1; i < 13; i++)
        {
            tjy.Items.Add(new ListItem(i.ToString(), i.ToString()));
        }

        if (Request.QueryString["tjn"] != null)
        {
            tjn.Items.FindByText(Request.QueryString["tjn"].ToString()).Selected = true;
            tjy.Items.FindByText(Request.QueryString["tjy"].ToString()).Selected = true;
        }
        else
        {
            tjn.Items.FindByText(year.ToString()).Selected = true;
            tjy.Items.FindByText(month.ToString()).Selected = true;
        }

        string DB2ConnectionString = ApplicationClass.ConnectionString;

        DataTable result = new DataTable();

        //string proname = "ZXJXTJ_ZXGZKP";
        //string ffydm = "2760";
        //string fydm = "0";
        //string tjn1 = "2012";
        //string tjy1 = "6";

        string proname = "ZXJXTJ_ZXGZKP";
        ffydm.Text = "2760";
        fydm.Text = "0";

        if (Request.QueryString["fydm"] != null)
        {
            fydm.Text = Request.QueryString["fydm"].ToString();
        }

        if (Request.QueryString["ffydm"] != null)
        {
            ffydm.Text = Request.QueryString["ffydm"].ToString();
        }

        if (Request.QueryString["tjn"] != null)
        {
            tjn.Text = Request.QueryString["tjn"].ToString();
        }

        if (Request.QueryString["tjy"] != null)
        {
            tjy.Text = Request.QueryString["tjy"].ToString();
        }

        get_str = "tjn=" + tjn.Text + "&tjy=" + tjy.Text + "&ffydm=0&fydm=";



        DataTable dt = null;
        DBService.DBParameterCollentions collentios = new DBService.DBParameterCollentions();
        addPara(collentios, "IN_TJN", tjn.Text, ParameterDirection.Input);
        addPara(collentios, "IN_TJY", tjy.Text, ParameterDirection.Input);
        addPara(collentios, "IN_FYDM", Int32.Parse(fydm.Text), ParameterDirection.Input);
        addPara(collentios, "IN_FFYDM", Int32.Parse(ffydm.Text), ParameterDirection.Input);
       
        dt = ApplicationClass.AppDBService.ExcecuteStoredProcedure(ApplicationClass.ConnectionString, proname, collentios);


        dt1 = dt;
      

        try
        {
            Repeater1.DataSource = dt1;
            Repeater1.DataBind();
        }
        catch (Exception ex) { dt = null; }
    }
    private  void addPara(DBService.DBParameterCollentions paras, string columname, object value, ParameterDirection direction)
    {
        DBService.DBParameter para = new DBService.DBParameter();
        para.Direction = direction;
        para.ColumnName = columname;
        para.value = value;
        paras.AddDBParameter(para);
    }
}
